﻿@model List<Models.Models.User>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<h2>Index</h2>
this is create by @ViewBag.CreateUser
<table>
    @foreach(Models.Models.User user in Model)
    {
        <tr>
            <td>@user.Id</td>
            <td>@user.Name</td>
            <td>@user.Age</td>
            <td>@Html.ActionLink("Edit","Edit",new{Id=@user.Id})</td>
            <td><a href="javascript:fnDelete('@user.Id')">Delete</a></td>
        </tr>
    }
</table>
<script type="text/javascript">
    function fnDelete(id)
    {
        if (confirm("delete ?"))
        {
            location.href = '@Url.Action("Delete")/'+id;
        }
    }

</script>